import os,datetime
import excel as ex

student_list = [1,2]
student_number_list = []

# 后补日期(按需调整)，以2020年11月19日为例：
# previous_date = '20201119'
previous_date = None

def mkdir(path):
    folder = os.path.exists(path)
    if not folder:                   
        os.makedirs(path)            
        print("---  new folder【%s】...  ---"%(path))
        print("---  OK  ---")
    #else:
        #print("---  There is this folder!  ---")

def make(student_number,date):
    global student_number_list
    root_dir = os.getcwd()
    mkdir(root_dir+"\\feedback")
    mkdir(root_dir+"\\"+student_number+"\\"+date)

def main():
    global student_number_list
    ex.excel_open()
    root_dir = os.getcwd()
    now = datetime.datetime.now()
    ex.get_student_number(student_list, student_number_list)
    for str in student_number_list:
        if previous_date is None:
            mkdir(root_dir+"\\"+str+"\\"+now.strftime("%Y%m%d"))
        else:
            mkdir(root_dir+"\\"+str+"\\"+previous_date)
    ex.excel_close()
    print("mkdir all done !")
    os.system('pause')

if __name__ == '__main__':
    main()